package com.oros.db;

public class AEGeneratedWritable implements AEGeneratedData {

	private static final long serialVersionUID = 1L;
    private	boolean resetable;
	private Object resetValue;
	
	public AEGeneratedWritable()
	{
         resetable=false;resetValue=null;		
	}
	
	public AEGeneratedWritable(Object resetValue)
	{
		resetable=true;
		this.resetValue = resetValue;
	}
	@Override
	public Object generateCell(AETableContainer table, AERawItem item,
			int columnNo,int action) {
		Object a = item.getColumnValue(columnNo); 
		return getValidated(a,action);
	}
	public Object getValidated(Object val,int action)
	{
		if (resetable)
		{
			if (action!=ACTION_MODIFICATION && action!=ACTION_COPY_FROM_ENTITY) return resetValue;
		}
		return val;
	}

}
